<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <!--适应移动端-->
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>博客详情</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../static/css/typo.css">    <!--文本样式-->
    <link rel="stylesheet" href="../static/css/animate.css">    <!--动画效果-->
    <link rel="stylesheet" href="../static/lib/prism/prism.css">
    <link rel="stylesheet" href="../static/lib/tocbot/tocbot.css">
    <link rel="stylesheet" href="../static/css/me.css">
</head>
<body>
<!--导航-->
<nav th:replace="_fragments :: nav(1)" class="ui inverted attached segment m-padded-tb-mini m-opacity-mini fly">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">Swim's Blog</h2>
            <a href="#" class="item m-mobile-hide m-item"><i class="home icon"></i>首页</a>
            <a href="#" class="item m-mobile-hide m-item"><i class="idea icon"></i>分类</a>
            <a href="#" class="item m-mobile-hide m-item"><i class="tags icon"></i>标签</a>
            <a href="#" class="item m-mobile-hide m-item"><i class="clone icon"></i>归档</a>
            <a href="#" class="item m-mobile-hide m-item"><i class="info icon"></i>关于我</a>

            <div class="right m-item item m-mobile-hide ">
                <div class="ui icon inverted transparent input">
                    <input type="text" title="" placeholder="Search for something">
                    <i class="search link icon"></i>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui menu toggle  black icon button m-top-right m-mobile-show">
        <i class="sidebar icon"></i>
    </a>

</nav>

<!--中间内容部分-->
<div class="m-container-small m-padded-tb-large animated fadeIn">
    <div class="ui container">
        <div class="ui top attached segment">
            <div class="ui link list horizontal ">
                <div class="item">
                    <img src="https://unsplash.it/100/100?image=1005"
                         class="ui avatar image" th:src="@{${blog.user.avatar}}" alt="">
                    <div class="content">
                        <a href="#" class="header" th:text="${blog.user.nickname}">RYX</a>
                    </div>
                </div>
                <div class="item">
                    <i class="calendar icon"></i> <span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2020-06-21</span>
                </div>

                <div class="item">
                    <i class="eye icon"></i> <span th:text="${blog.views}">123</span>
                </div>

            </div>
        </div>

        <div class="attached ui segment">
            <!--图片-->
            <img src="../static/img/bg.png" th:src="@{${blog.firstPicture}}" alt="" class="ui fluid image"
                 style="width: 800px;height: 450px;">
        </div>

        <div id="waypoint" class="ui attached padded segment ">
            <!--内容-->
            <div class="ui right aligned basic segment">
                <div class="label ui basic yellow" th:text="${blog.flag}">原创</div>
            </div>

            <h2 class="ui center aligned header" th:text="${blog.title}">实践出真知</h2>
            <br>
            <!--文章主要内容-->
            <div id="content" class="typo typo-selection m-padded-lr-responsive m-padded-tb-large js-toc-content"
                 th:utext="${blog.content}">
                <h2 id="1">第一段</h2>
                <p>《关于费尔巴哈的提纲》，是马克思在1845年春在布鲁塞尔写成的批判费尔巴哈的十一条提纲，并没有发表，
                    但后面恩格斯发表，它被恩格斯称为“包含着新世界观的天才萌芽的第一个文件”，“历史唯物主义的起源”。
                    提纲只有短短的一千来字，却深刻地批判了旧唯物主义的缺陷，其直观性和受动性，并确定了辩证唯物主义的基本观点，
                    也就是实践观点，也是我读完提纲后的感悟：实践出真知。
                </p>
                <!--代码高亮显示案例               -->
                <pre><code class="language-css">p { color: red }   </code></pre>
                <h2 id="2">第二段</h2>
                <p>
                    在《关于费尔巴哈的提纲》中，马克思从实际出发，吸收前人的经验和教训，科学地评价了费尔巴哈在宗教批判上的成就以及其局限性，
                    并指出费尔巴哈仅仅是揭露了宗教的外表，并没有真正的推倒宗教，若要消灭宗教，其根本方法是通过实践的方式来改造社会，
                    要通过社会实践来揭露社会的各种矛盾，例如生产力与生产关系的矛盾，资产阶级与无产阶级之间的矛盾等等。并且马克思还在提纲中批判了费尔巴哈抽象的人性论，
                    并给出了自己的观点：“人的本质并不是单个人所固有的抽象物。在其现实性上，它是一切社会关系的总和”，人的本质在于其社会性，
                    并且人总是处于一定的社会关系中，要从社会实践中了解人的本质和社会生活，而费尔巴哈正是忽略了这些，脱离人的社会实践去理解和看待感性，并被马克思指出。
                </p>
                <p>
                    在《关于费尔巴哈的提纲》中，能感受到字里行间都强调了社会实践，社会实践的观点和辩证唯物主义思想贯穿了整个提纲，强调了实践在检验真理起到了很大的作用，
                    实践出真知，实践是检验真理的唯一标准，这话说的一点也没错，虽然该提纲全文只有一千来字，却给我深入理解和学习马克思主义提供了很大的帮助，让我受益匪浅。
                </p>

            </div>
            <!--标签-->
            <div class="m-padded-lr-responsive m-padded-tb-large">
                <div class="ui basic red left  label" th:each="tag : ${blog.tags}" th:text="${tag.name}">马克思</div>
            </div>

            <!--赞赏-->
            <div th:if="${blog.appreciation}">
                <div class="ui center aligned segment basic">
                    <button id="payButton" class="ui basic yellow button">赞赏</button>
                </div>

                <div class="ui payQR popup flowing transition hidden">

                    <div class="ui orange basic label">
                        <div class="ui images" style="font-size: inherit !important;">
                            <div class="image">
                                <img src="../static/img/Money.jpg" th:src="@{/img/Money.jpg}" alt=""
                                     class="ui rounded image bordered"
                                     style="width: 120px;height: 180px;">
                                <div>Wechat Pay</div>
                            </div>
                            <div class="image">
                                <img src="../static/img/Money2.jpg" th:src="@{/img/Money2.jpg}" alt=""
                                     class="ui rounded image bordered"
                                     style="width: 120px;height: 180px;">
                                <div>Alipay Payment</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </div>

        <div class="ui attached positive message" th:if="${blog.shareStatement}">
            <!--博客信息-->
            <div class="ui middle aligned grid">
                <div class="eleven wide column">
                    <ul class="list">
                        <li>作者：<span th:text="${blog.user.nickname}">RYX</span> ==> <a href="/star/templates/blog.html"
                                                                                       th:href="@{/about}"
                                                                                       target="_blank">联系作者</a></li>
                        <li>发布时间：<span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd HH:mm')}">2020-7-12</span>
                        </li>
                        <li>喜欢就赞赏一下呗,生活艰难哎</li>
                    </ul>
                </div>

                <div class="five wide column">
                    <img src="../static/img/Qr.jpg" alt="" th:src="@{/img/Qr.jpg}"
                         class="ui rounded right floated bordered image"
                         style="width: 110px; "/>
                </div>

            </div>
        </div>

        <div class="ui bottom attached  segment" th:if="${blog.commentabled}">
            <!--留言区-->
            <div id="comment-container" class="ui segment olive ">
                <div th:fragment="commentList">
                    <div class="ui comments" style="max-width: 100%">
                        <h3 class="ui dividing header">Comments</h3>
                        <div class="comment" th:each="comment : ${comments}">
                            <a class="avatar">
                                <img src="https://unsplash.it/100/100?image=1004" th:src="@{${comment.avatar}}">
                            </a>
                            <div class="content">
                                <a class="author" >
                                    <span th:text="${comment.nickname}">RYX</span>
                                    <div class="ui mini label basic orange left pointing m-padded-mini" th:if="${comment.adminComment}">Manger</div>
                                </a>
                                <div class="metadata">
                                    <span class="date" th:text="${#dates.format(comment.createTime,'yyyy-MM-dd HH:mm')}">今天下午 5:42</span>
                                </div>
                                <div class="text" th:text="${comment.content}">今天是祖安Party！</div>
                                <div class="actions">
                                    <a class="reply" data-commentid="1" data-commentnickname="RYX" th:attr="data-commentid=${comment.id},data-commentnickname=${comment.nickname}" onclick="reply(this)">Reply</a>
                                </div>
                            </div>
                            <div class="comments" th:if="${#arrays.length(comment.replyComments)}>0">
                                <div class="comment" th:each="reply : ${comment.replyComments}">
                                    <a class="avatar">
                                        <img src="https://unsplash.it/100/100?image=1004" th:src="@{${reply.avatar}}">
                                    </a>
                                    <div class="content">
                                        <a class="author" >
                                            <span th:text="${reply.nickname}">Lin</span>
                                            <div class="ui mini label basic orange left pointing m-padded-mini" th:if="${reply.adminComment}">Manger</div>
                                            &nbsp;&nbsp; <span th:text="|@${reply.parentComment.nickname}|" class="text-color">@RYX</span>
                                        </a>
                                        <div class="metadata">
                                            <span class="date" th:text="${#dates.format(reply.createTime,'yyyy-MM-dd HH:mm')}">今天下午 5:42</span>
                                        </div>
                                        <div class="text" th:text="${reply.content}">今天是祖安Party！</div>
                                        <div class="actions">
                                            <a class="reply" data-commentid="1" data-commentnickname="RYX" th:attr="data-commentid=${reply.id},data-commentnickname=${reply.nickname}" onclick="reply(this)">Reply</a>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
<!--/*-->
                        <div class="comment">
                            <a class="avatar">
                                <img src="https://unsplash.it/100/100?image=1004">
                            </a>
                            <div class="content">
                                <a class="author">Elliot Fu</a>
                                <div class="metadata">
                                    <span class="date">昨天上午12:30</span>
                                </div>
                                <div class="text">
                                    <p>丨nmd</p>
                                </div>
                                <div class="actions">
                                    <a class="reply">Reply</a>
                                </div>
                            </div>
                            <div class="comments">
                                <div class="comment">
                                    <a class="avatar">
                                        <img src="https://unsplash.it/100/100?image=1005">
                                    </a>
                                    <div class="content">
                                        <a class="author">Jenny Hess</a>
                                        <div class="metadata">
                                            <span class="date">刚刚</span>
                                        </div>
                                        <div class="text">你是sb吗？</div>
                                        <div class="actions">
                                            <a class="reply">Reply</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="comment">
                            <a class="avatar">
                                <img src="https://unsplash.it/100/100?image=1005">
                            </a>
                            <div class="content">
                                <a class="author">Joe Henderson</a>
                                <div class="metadata">
                                    <span class="date">5 天以前</span>
                                </div>
                                <div class="text">cnmd 时间管理无敌 好吧</div>
                                <div class="actions">
                                    <a class="reply">Reply</a>
                                </div>
                            </div>
                        </div>
<!--*/-->
                    </div>
                </div>

            </div>
            <!--    form表单区域-->
            <div id="comment-form" class="ui form" >
                <input type="hidden" name="blog.id" th:value="${blog.id}">
                <input type="hidden" name="parentComment.id" value="-1">
                <div class="field">
                    <textarea title="" name="content" placeholder="请输入评论内容"></textarea>
                </div>

                <div class="fields">
                    <div class="field m-mobile-wide m-margin-bottom-small">
                        <div class="ui left icon input">
                            <i class="user icon"></i>
                            <input type="text" name="nickname" placeholder="姓名" th:value="${session.user}!=null ? ${session.user.nickname}">
                        </div>
                    </div>

                    <div class="field m-mobile-wide m-margin-bottom-small">
                        <div class="ui left icon input">
                            <i class="mail icon"></i>
                            <input type="text" name="email" placeholder="邮箱" th:value="${session.user}!=null ? ${session.user.email}">
                        </div>
                    </div>

                    <div class="field  m-margin-bottom-small m-mobile-wide">
                        <button id="comment-btn" type="button" class="ui pink button m-mobile-wide">Commit</button>
                    </div>

                </div>

            </div>
        </div>


    </div>
</div>


<div id="toolbar" class="m-padded m-fixed m-right-bottom " style="display: none">
    <div class="ui vertical icon buttons ">
        <button type="button" class="ui toc-btn yellow button">Menu</button>
        <a href="#comment-container" class="ui yellow  button"> <i class="icon comment outline"></i></a>
        <button class="ui wechat icon yellow button"><i class="weixin icon"></i></button>
        <div id="toTop-button" class="ui yellow button"><i class="icon up chevron"></i></div>
    </div>
</div>

<div class="ui toc-container popup flowing transition hidden" style="width: 250px;">
    <!--弹出的目录-->
    <ol class="js-toc">

    </ol>
</div>

<!--弹出的二维码-->
<div id="qrcode" class="ui wechat-qr popup flowing transition hidden" style="width: 130px;">
    <img src="../static/img/Qr.jpg" th:src="@{/img/Qr.jpg}" alt="" class="ui rounded image" style="width: 130px;">
</div>


<br>
<br>
<!--底部-->
<footer th:replace="_fragments :: footer" class="ui inverted segment vertical m-padded-tb-massive">
    <div class="ui container center aligned">
        <div class="ui  inverted stackable divided grid">
            <div class="three wide column">
                <img src="../static/img/Qr.jpg" class="ui rounded image" style="width: 110px;">
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header">最新blog</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item ">My story </a>
                    <a href="#" class="item ">My story </a>
                    <a href="#" class="item ">My story </a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header">最新blog</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item ">My story </a>
                    <a href="#" class="item ">My story </a>
                    <a href="#" class="item ">My story </a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header">最新blog</h4>
                <p class="m-text-spaced m-opacity-mini">只要学不死，就往死里学，加油，噢利给！！！</p>
            </div>

        </div>
        <div class="ui inverted section divider"></div>
        <p class="m-text-thin m-text-spaced m-opacity-mini ">Copyright@2020-2021 Swim's Blog Designed by RYX</p>

    </div>
</footer>

<th:block th:replace="_fragments :: script">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
    <script src="//cdn.jsdelivr.net/npm/jquery.scrollto@2.1.2/jquery.scrollTo.min.js"></script>
    <script src="../static/lib/prism/prism.js"></script>
    <!--<script src="../static/lib/qrcode/qrcode.min.js"></script>-->
    <script src="../static/lib/tocbot/tocbot.min.js"></script>
    <script src="../static/lib/waypoints/jquery.waypoints.min.js"></script>
</th:block>


<script th:inline="javascript">
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });


    $('#payButton').popup({
        popup: $('.payQR.popup'),
        on: 'click',
        position: 'bottom center'
    });

    $('.toc-btn').popup({
        popup: $('.toc-container'),
        on: 'click',
        position: 'left center'
    });

    $('.wechat').popup({
        popup: $('.wechat-qr'),
        on: 'hover',
        position: 'left center'
    });

    $('#toTop-button').click(function () {
        $(window).scrollTo(0, 500);
    });

    $('#toTalk-button').click(function () {
        $(window).scrollTo(0, 500);
    });

    let waypoint = new Waypoint({
        element: document.getElementById('waypoint'),
        handler: function (direction) {
            if (direction === 'down') {
                $('#toolbar').show(500);
            } else {
                $('#toolbar').hide(500);
            }
        }
    });

    //评论表单验证
    $('.ui.form').form({
        fields: {
            title: {
                identifier: 'content',
                rules: [{
                    type: 'empty',
                    prompt: '请输入评论内容'
                }
                ]
            },
            content: {
                identifier: 'nickname',
                rules: [{
                    type: 'empty',
                    prompt: '请输入你的名字'
                }]
            },
            type: {
                identifier: 'email',
                rules: [{
                    type: 'email',
                    prompt: '请填写正确的邮箱地址'
                }]
            }
        }
    });

    $(function () {
        $("#comment-container").load(/*[[@{/comments/{id}(id=${blog.id})}]]*/);
    });


    $('#comment-btn').click(function () {
        var boo = $('.ui.form').form('validate form');
        if (boo) {
            console.log("Success");
            postData();
        } else {
            console.log("提交信息有点问题喔");
        }
    });

    function postData() {
        $("#comment-container").load(/*[[@{/comments}]]*/"", {
            "parentComment.id": $("[name='parentComment.id']").val(),
            "blog.id": $("[name='blog.id']").val(),
            "nickname": $("[name='nickname']").val(),
            "email": $("[name='email']").val(),
            "content": $("[name='content']").val()
        }, function (responseTxt, statusTxt, xhr) {
            // $(window).scrollTop($('#comment-container'), 500);
            clearContent();
        });
    }

    function clearContent() {
        $("[name='content']").val('');
        $("[name='parentComment.id']").val(-1);
        $("[name='content']").attr("placeholder", "请输入评论信息...");
    }


    function reply(obj) {
        var commentId = $(obj).data('commentid');
        var commentNickname = $(obj).data('commentnickname');
        $("[name='content']").attr("placeholder", "@"+commentNickname).focus();
        $("[name='parentComment.id']").val(commentId);
        // $(window).scrollTo($('#comment-form'),500);
    }


    // 菜单标题
    //    tocbot init
    tocbot.init({
        // Where to render the table of contents.
        tocSelector: '.js-toc',
        // Where to grab the headings to build the table of contents.
        contentSelector: '.js-toc-content',
        // Which headings to grab inside of the contentSelector element.
        headingSelector: 'h1, h2, h3',
        // For headings inside relative or absolute positioned containers within content.
        hasInnerContainers: true,
    });

    // var qrcode = new QRCode("qrcode", {
    //     text: "img/Qr.jpg",
    //     width: 120,
    //     height: 120,
    //     colorDark : "#000000",
    //     colorLight : "#ffffff",
    //     correctLevel : QRCode.CorrectLevel.H
    // });


    /*单击出现社会主义核心价值观特效*/
    $(document).ready(function () {
        var a_index = 0;
        $("body").click(function (e) {
            var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
            var $i = $("<span/>").text(a[a_index]);
            a_index = (a_index + 1) % a.length;
            var x = e.pageX, y = e.pageY;
            $i.css({
                "z-index": 99999,
                "top": y - 20,
                "left": x,
                "position": "absolute",
                "font-weight": "bold",
                "color": "#ff6651"
            });
            $("body").append($i);
            $i.animate({"top": y - 180, "opacity": 0}, 1500, function () {
                $i.remove();
            });
        });
    });

    /*单击出现爱心特效*/
    (function (window, document, undefined) {
        var hearts = [];
        window.requestAnimationFrame = (function () {
            return window.requestAnimationFrame ||
                window.webkitRequestAnimationFrame ||
                window.mozRequestAnimationFrame ||
                window.oRequestAnimationFrame ||
                window.msRequestAnimationFrame ||
                function (callback) {
                    setTimeout(callback, 1000 / 60);
                }
        })();
        init();

        function init() {
            css(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: absolute;}.heart:after{top: -5px;}.heart:before{left: -5px;}");
            attachEvent();
            gameloop();
        }

        function gameloop() {
            for (var i = 0; i < hearts.length; i++) {
                if (hearts[i].alpha <= 0) {
                    document.body.removeChild(hearts[i].el);
                    hearts.splice(i, 1);
                    continue;
                }
                hearts[i].y--;
                hearts[i].scale += 0.004;
                hearts[i].alpha -= 0.013;
                hearts[i].el.style.cssText = "left:" + hearts[i].x + "px;top:" + hearts[i].y + "px;opacity:" + hearts[i].alpha + ";transform:scale(" + hearts[i].scale + "," + hearts[i].scale + ") rotate(45deg);background:" + hearts[i].color;
            }
            requestAnimationFrame(gameloop);
        }

        function attachEvent() {
            var old = typeof window.onclick === "function" && window.onclick;
            window.onclick = function (event) {
                old && old();
                createHeart(event);
            }
        }

        function createHeart(event) {
            var d = document.createElement("div");
            d.className = "heart";
            hearts.push({
                el: d,
                x: event.clientX - 5,
                y: event.clientY - 5,
                scale: 1,
                alpha: 1,
                color: randomColor()
            });
            document.body.appendChild(d);
        }

        function css(css) {
            var style = document.createElement("style");
            style.type = "text/css";
            try {
                style.appendChild(document.createTextNode(css));
            } catch (ex) {
                style.styleSheet.cssText = css;
            }
            document.getElementsByTagName('head')[0].appendChild(style);
        }

        function randomColor() {
            return "rgb(" + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + ")";
        }
    })(window, document);

    /*背景雪花飘落特效*/
    (function ($) {
        $.fn.snow = function (options) {
            var $flake = $('<div id="flake" />').css({'position': 'absolute', 'top': '-50px'}).html('&#10052;'),
                documentHeight = $(document).height(), documentWidth = $(document).width(),
                defaults = {minSize: 20, maxSize: 40, newOn: 300, flakeColor: "#f08080"},
                options = $.extend({}, defaults, options);
            var interval = setInterval(function () {
                var startPositionLeft = Math.random() * documentWidth - 100, startOpacity = 0.5 + Math.random(),
                    sizeFlake = options.minSize + Math.random() * options.maxSize, endPositionTop = documentHeight - 40,
                    endPositionLeft = startPositionLeft - 100 + Math.random() * 200,
                    durationFall = documentHeight * 10 + Math.random() * 5000;
                $flake.clone().appendTo('body').css({
                    left: startPositionLeft,
                    opacity: startOpacity,
                    'font-size': sizeFlake,
                    color: options.flakeColor
                }).animate({
                    top: endPositionTop,
                    left: endPositionLeft,
                    opacity: 0.2
                }, durationFall, 'linear', function () {
                    $(this).remove()
                });
            }, options.newOn);
        };
    })(jQuery);
    $.fn.snow({minSize: 5, maxSize: 50, newOn: 700, flakeColor: '#FFF'});

</script>

</body>
<script>

</script>
</html>